home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / String Mak244058102001.psc / String Maker / frmCreateTable.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-08-09  |  7.1 KB  |  237 lines

  1. VERSION 5.00
  2. Begin VB.Form frmCreateTable 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "SQL Create Table"
  5.    ClientHeight    =   2115
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   5175
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   2115
  14.    ScaleWidth      =   5175
  15.    Begin VB.CommandButton cmdEndCreate 
  16.       Caption         =   "End Create"
  17.       Enabled         =   0   'False
  18.       Height          =   375
  19.       Left            =   3840
  20.       TabIndex        =   7
  21.       Top             =   1680
  22.       Width           =   1215
  23.    End
  24.    Begin VB.CommandButton cmdClear 
  25.       Caption         =   "Clear"
  26.       Height          =   375
  27.       Left            =   840
  28.       TabIndex        =   8
  29.       Top             =   1680
  30.       Width           =   1215
  31.    End
  32.    Begin VB.ComboBox cboxDataType 
  33.       Height          =   315
  34.       Left            =   1200
  35.       TabIndex        =   4
  36.       Text            =   "Select Type"
  37.       Top             =   1080
  38.       Width           =   1575
  39.    End
  40.    Begin VB.CommandButton cmdAddField 
  41.       Caption         =   "Add"
  42.       Height          =   375
  43.       Left            =   4080
  44.       TabIndex        =   6
  45.       Top             =   1080
  46.       Width           =   975
  47.    End
  48.    Begin VB.Frame Frame2 
  49.       Height          =   1095
  50.       Left            =   0
  51.       TabIndex        =   10
  52.       Top             =   480
  53.       Width           =   5175
  54.       Begin VB.TextBox txtFieldSize 
  55.          Alignment       =   1  'Right Justify
  56.          Enabled         =   0   'False
  57.          Height          =   285
  58.          Left            =   3360
  59.          TabIndex        =   5
  60.          Text            =   "1"
  61.          Top             =   600
  62.          Width           =   615
  63.       End
  64.       Begin VB.TextBox txtFieldName 
  65.          Height          =   285
  66.          Left            =   1200
  67.          TabIndex        =   3
  68.          Top             =   240
  69.          Width           =   3855
  70.       End
  71.       Begin VB.Label Label4 
  72.          Caption         =   "Size:"
  73.          Height          =   255
  74.          Left            =   2880
  75.          TabIndex        =   13
  76.          Top             =   600
  77.          Width           =   495
  78.       End
  79.       Begin VB.Label Label3 
  80.          Caption         =   "Field Type:"
  81.          Height          =   255
  82.          Left            =   240
  83.          TabIndex        =   12
  84.          Top             =   600
  85.          Width           =   975
  86.       End
  87.       Begin VB.Label Label2 
  88.          Caption         =   "Field Name:"
  89.          Height          =   255
  90.          Left            =   240
  91.          TabIndex        =   11
  92.          Top             =   240
  93.          Width           =   1335
  94.       End
  95.    End
  96.    Begin VB.CommandButton cmdCreate 
  97.       Caption         =   "Create"
  98.       Height          =   255
  99.       Left            =   4080
  100.       TabIndex        =   1
  101.       Top             =   120
  102.       Width           =   975
  103.    End
  104.    Begin VB.TextBox txtTableName 
  105.       Height          =   285
  106.       Left            =   1200
  107.       TabIndex        =   0
  108.       Top             =   120
  109.       Width           =   2775
  110.    End
  111.    Begin VB.Frame Frame1 
  112.       Height          =   495
  113.       Left            =   0
  114.       TabIndex        =   2
  115.       Top             =   0
  116.       Width           =   5175
  117.       Begin VB.Label Label1 
  118.          Caption         =   "Table Name:"
  119.          Height          =   255
  120.          Left            =   120
  121.          TabIndex        =   9
  122.          Top             =   120
  123.          Width           =   1095
  124.       End
  125.    End
  126. Attribute VB_Name = "frmCreateTable"
  127. Attribute VB_GlobalNameSpace = False
  128. Attribute VB_Creatable = False
  129. Attribute VB_PredeclaredId = True
  130. Attribute VB_Exposed = False
  131. Private Sub cboxDataType_Click()
  132. If cboxDataType.Text = DTArray(0) Or cboxDataType.Text = DTArray(13) Then
  133. txtFieldSize.Enabled = True
  134. txtFieldSize.Enabled = False
  135. End If
  136. End Sub
  137. Private Sub cboxDataType_Change()
  138. 'cboxDataType.Text = DTArray(0)
  139. 'txtFieldSize.Enabled = True
  140. End Sub
  141. Private Sub cboxDataType_KeyPress(KeyAscii As Integer)
  142. KeyAscii = 0
  143. End Sub
  144. Private Sub cmdAddField_Click()
  145. Dim again As String
  146. If frmOutput.txtOutput.Text = "" Then
  147. MsgBox "Must create a table first!"
  148. cmdCreate.Enabled = True
  149. Exit Sub
  150. End If
  151. If txtFieldName.Text = "" Then
  152. MsgBox "Must give the field a name"
  153. txtFieldName.SetFocus
  154. Exit Sub
  155. End If
  156. If txtFieldSize.Enabled = True And IsNumeric(txtFieldSize) = False Then
  157. MsgBox "Field Size must have numeric values only"
  158. txtFieldSize.SetFocus
  159. Exit Sub
  160. End If
  161. If txtFieldSize.Enabled = True And (CInt(txtFieldSize.Text) > 255 Or CInt(txtFieldSize.Text) < 1) = True Then
  162. MsgBox "Must set a valid field size"
  163. txtFieldSize.SetFocus
  164. Exit Sub
  165. End If
  166. If cboxDataType.Text = "Select Type" Then
  167. MsgBox "Must select a data type"
  168. Exit Sub
  169. End If
  170. If txtFieldSize.Enabled = False Then
  171. again = RecipientVar & " = " & RecipientVar & " & " & Chr(34) & "[" & txtFieldName.Text & "] " & cboxDataType.Text & "," & Chr(34) & vbNewLine
  172. again = RecipientVar & " = " & RecipientVar & " & " & Chr(34) & "[" & txtFieldName.Text & "] " & cboxDataType.Text & "(" & txtFieldSize.Text & ")," & Chr(34) & vbNewLine
  173. End If
  174. frmOutput.txtOutput.Text = frmOutput.txtOutput.Text & again
  175. txtFieldName.SetFocus
  176. End Sub
  177. Private Sub cmdClear_Click()
  178. frmOutput.txtOutput.Text = ""
  179. cmdCreate.Enabled = True
  180. End Sub
  181. Private Sub cmdCreate_Click()
  182. Dim again As String
  183. If RecipientVar = "" Then RecipientVar = "Var"
  184. If txtTableName.Text = "" Then
  185. MsgBox "Must Enter a table name"
  186. Exit Sub
  187. End If
  188. again = RecipientVar & " = " & Chr(34) & "CREATE TABLE [" & txtTableName.Text & "] (" & Chr(34) & " "
  189. again = again & vbNewLine
  190. frmOutput.txtOutput.Text = again
  191. cmdCreate.Enabled = False
  192. cmdEndCreate.Enabled = True
  193. End Sub
  194. Private Sub cmdEndCreate_Click()
  195. Dim again As String
  196. If frmOutput.txtOutput.Text = "" Then
  197. MsgBox "There is no table to end"
  198. Exit Sub
  199. End If
  200. again = Mid(frmOutput.txtOutput.Text, 1, Len(frmOutput.txtOutput.Text) - 4)
  201. again = again & Chr(34) & vbNewLine
  202. again = again & RecipientVar & " = " & RecipientVar & " & " & Chr(34) & ")" & Chr(34)
  203. frmOutput.txtOutput.Text = again
  204. End Sub
  205. Private Sub Form_GotFocus()
  206. If frmOutput.txtOutput.Text = "" Then cmdCreate.Enabled = True
  207. End Sub
  208. Private Sub Form_Load()
  209. Dim o As Integer
  210. DTArray(0) = "Binary"
  211. DTArray(1) = "BIT"
  212. DTArray(2) = "BYTE"
  213. DTArray(3) = "COUNTER"
  214. DTArray(4) = "Currency"
  215. DTArray(5) = "Date/Time"
  216. DTArray(6) = "GUID"
  217. DTArray(7) = "Single"
  218. DTArray(8) = "Double"
  219. DTArray(9) = "Short"
  220. DTArray(10) = "Long"
  221. DTArray(11) = "LONGTEXT"
  222. DTArray(12) = "LONGBINARY"
  223. DTArray(13) = "Text"
  224. For o = 0 To 13
  225. cboxDataType.AddItem DTArray(o)
  226. Next o
  227. End Sub
  228. Private Sub txtFieldName_GotFocus()
  229. SelectAll txtFieldName
  230. End Sub
  231. Private Sub txtFieldSize_GotFocus()
  232. SelectAll txtFieldSize
  233. End Sub
  234. Private Sub txtTableName_GotFocus()
  235. SelectAll txtTableName
  236. End Sub
  237.